Private Sub Workbook_BeforePrint(Cancel As Boolean)
 
    Cancel = ynProtect
 
End Sub
 
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
 
    If SaveAsUI And ynProtect Then Cancel = True
 
End Sub
 
Private Sub Workbook_NewSheet(ByVal Sh As Object)
 
    If ynProtect Then
   
        Application.DisplayAlerts = False
            Sh.Delete
        Application.DisplayAlerts = True
   
    End If
   
End Sub
 
Private Sub Workbook_Open()
   
    Dim sTitle As String
    Dim sMsg As String
    Dim sMsg2 As String
    Dim sMsg3 As String
    Dim vInput As Variant
    Dim sPwd As String
    Dim i As Integer
   
    sTitle = "ȣ "
    sMsg = "  ׸ ȣϵ Ͻðڽϱ?" & vbCr & vbCr & _
             "1. ٸ Ϸ  " & vbCr & _
             "2. ٸ Ϸ  " & vbCr & _
             "3. μ " & vbCr & _
             "4. Ʈ ߰ "
   
    sMsg2 = "   ۾ ȣ˴ϴ." & vbCr & vbCr & _
             "1. ٸ Ϸ  " & vbCr & _
             "2. ٸ Ϸ  " & vbCr & _
             "3. μ " & vbCr & _
             "4. Ʈ ߰ "
    sMsg3 = "ȣ Էϼ!"
 
    sPwd = "1234"
 
    Select Case MsgBox(sMsg, vbQuestion + vbYesNo, sTitle)
 
        Case vbYes
            ynProtect = True
            MsgBox sMsg2, vbInformation, sTitle
        Case vbNo
            ynProtect = False
            Do
                i = i + 1
                If i > 3 Then
                    MsgBox sMsg2, vbInformation, sTitle
                    ynProtect = True
                    Exit Sub
                Else
                    vInput = InputBox(sMsg3, sTitle)
                End If
            Loop Until CStr(vInput) = sPwd
    End Select
 
End Sub
 
Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
 
    If Not Intersect(Wn.ActiveSheet.UsedRange, Wn.ActiveCell) Is Nothing And ynProtect Then
        Application.CutCopyMode = False
    End If
   
End Sub
